/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.cncqs.backend.company.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.sys.entity.Area;
import com.jeesite.modules.sys.entity.Company;
import com.jeesite.modules.sys.entity.Employee;
import com.jeesite.modules.sys.entity.Office;
import io.swagger.models.auth.In;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.util.Date;

/**
 * 企业管理Entity
 * @author cxy
 * @version 2019-04-16
 */
@Table(name="com_company", alias="a", columns={
		@Column(name="id", attrName="id", label="id", isPK=true),
		@Column(name="name", attrName="name", label="企业名称", queryType=QueryType.LIKE),
		@Column(name="type", attrName="type", label="企业类型"),
		@Column(name="check_status", attrName="checkStatus", label="审核状态"),
		@Column(name="business_num", attrName="businessNum", label="营业执照号"),
		@Column(name="business_indate", attrName="businessIndate", label="营业执照有效期"),
		@Column(name="business_picture", attrName="businessPicture", label="营业执照图片地址"),
		@Column(name="license_num", attrName="licenseNum", label="经营许可证号"),
		@Column(name="license_indate", attrName="licenseIndate", label="经营许可证有效期"),
		@Column(name="license_picture", attrName="licensePicture", label="许可证图片"),
		@Column(name="id_num", attrName="idNum", label="法人身份证号"),
		@Column(name="id_picture", attrName="idPicture", label="id_picture"),
		@Column(name="create_date", attrName="createDate", label="create_date", isUpdate=false, isQuery=false),
		@Column(name="update_date", attrName="updateDate", label="update_date", isQuery=false),
		@Column(name="remarks", attrName="remarks", label="备注", queryType=QueryType.LIKE),
		@Column(name="ref_code", attrName="refCode", label="机构编号"),
		@Column(name="ref_name", attrName="refName", label="机构名称"),
		@Column(name="store_name", attrName="storeName", label="门店名"),
		@Column(name="address", attrName="address", label="地址"),
		@Column(name="store_phone", attrName="storePhone", label="门店电话"),
		@Column(name="province", attrName="province", label="省"),
		@Column(name="city", attrName="city", label="市"),
		@Column(name="county", attrName="county", label="区/县"),
		@Column(name="detail_address", attrName="detailAddress", label="详细地址"),
		@Column(name="manager_name", attrName="managerName", label="负责人姓名"),
		@Column(name="manager_phone", attrName="managerPhone", label="负责人电话"),
		@Column(name="business_scope", attrName="businessScope", label="经营范围"),
		@Column(name="tag", attrName="tag", label="标签"),
		@Column(name="scale", attrName="scale", label="规模"),
		@Column(name="level", attrName="level", label="年度评级"),
		@Column(name="open_status", attrName="openStatus", label="经营状态"),
		@Column(name="complete_date", attrName="completeDate", label="完善时间"),
	},
		joinTable = {        @JoinTable(
				type = JoinTable.Type.JOIN,
				entity = Employee.class,
				alias = "e",
				on = "e.emp_code=a.ref_code",
				attrName = "employee",
				columns = {                @Column(
						includeEntity = Employee.class
				)}
		),         @JoinTable(
				type = JoinTable.Type.LEFT_JOIN,
				entity = Office.class,
				alias = "o",
				on = "o.office_code=e.office_code",
				attrName = "employee.office",
				columns = {                @Column(
						name = "office_code",
						label = "机构编码",
						isPK = true
				),                 @Column(
						name = "parent_codes",
						label = "所有父级编码",
						queryType = QueryType.LIKE
				),                 @Column(
						name = "view_code",
						label = "机构代码"
				),                 @Column(
						name = "office_name",
						label = "机构名称",
						isQuery = false
				),                 @Column(
						name = "full_name",
						label = "机构全称"
				),                 @Column(
						name = "office_type",
						label = "机构类型"
				),                 @Column(
						name = "leader",
						label = "负责人"
				),                 @Column(
						name = "phone",
						label = "电话"
				),                 @Column(
						name = "address",
						label = "联系地址"
				),                 @Column(
						name = "zip_code",
						label = "邮政编码"
				),                 @Column(
						name = "email",
						label = "邮箱"
				)}
		),             },
		extWhereKeys = "dsfOffice",
		orderBy="a.update_date DESC"
)
public class ComCompany extends DataEntity<ComCompany> {

	private static final long serialVersionUID = 1L;
	private String name;		// 企业名称
	private String businessNum;		// 营业执照号
	private Date businessIndate;		// 营业执照有效期
	private String businessPicture;		// 营业执照图片地址
	private String licenseNum;		// 经营许可证号
	private Date licenseIndate;		// 经营许可证有效期
	private String licensePicture;		// 许可证图片
	private String idNum;		// 法人身份证号
	private String idPicture;		// id_picture
	private Integer checkStatus;
	private String checkReason;
	private StringBuffer checkRecord;
	private String operator;
	private String refCode;
	private String refName;
	private Object refObj;
	private String storeName;
	private String address;
	private String storePhone;
	private String province;
	private String city;
	private String county;
	private String detailAddress;
	private String managerName;
	private String managerPhone;
	private String tag;
	private String businessScope;
	private Integer scale;
	private Integer level;
	private Integer openStatus;
	private Date completeDate;
	private Integer type;

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Integer getScale() {
		return scale;
	}

	public void setScale(Integer scale) {
		this.scale = scale;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public Integer getOpenStatus() {
		return openStatus;
	}

	public void setOpenStatus(Integer openStatus) {
		this.openStatus = openStatus;
	}

	public Date getCompleteDate() {
		return completeDate;
	}

	public void setCompleteDate(Date completeDate) {
		this.completeDate = completeDate;
	}

	public String getStoreName() {
		return storeName;
	}

	public void setStoreName(String storeName) {
		this.storeName = storeName;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getStorePhone() {
		return storePhone;
	}

	public void setStorePhone(String storePhone) {
		this.storePhone = storePhone;
	}

	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getCounty() {
		return county;
	}

	public void setCounty(String county) {
		this.county = county;
	}

	public String getDetailAddress() {
		return detailAddress;
	}

	public void setDetailAddress(String detailAddress) {
		this.detailAddress = detailAddress;
	}

	public String getManagerName() {
		return managerName;
	}

	public void setManagerName(String managerName) {
		this.managerName = managerName;
	}

	public String getManagerPhone() {
		return managerPhone;
	}

	public void setManagerPhone(String managerPhone) {
		this.managerPhone = managerPhone;
	}

	public String getTag() {
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

	public String getBusinessScope() {
		return businessScope;
	}

	public void setBusinessScope(String businessScope) {
		this.businessScope = businessScope;
	}

	public Object getRefObj() {
		return refObj;
	}

	public void setRefObj(Object refObj) {
		this.refObj = refObj;
	}

	public String getRefCode() {
		return refCode;
	}

	public void setRefCode(String refCode) {
		this.refCode = refCode;
	}

	public String getRefName() {
		return refName;
	}

	public void setRefName(String refName) {
		this.refName = refName;
	}

	public String getOperator() {
		return operator;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

	public String getCheckReason() {
		return checkReason;
	}

	public void setCheckReason(String checkReason) {
		this.checkReason = checkReason;
	}

	public StringBuffer getCheckRecord() {
		return checkRecord;
	}

	public void setCheckRecord(StringBuffer checkRecord) {
		this.checkRecord = checkRecord;
	}

	public Integer getCheckStatus() {
		return checkStatus;
	}

	public void setCheckStatus(Integer checkStatus) {
		this.checkStatus = checkStatus;
	}

	public ComCompany() {
		this(null);
	}

	public ComCompany(String id){
		super(id);
	}

	@NotBlank(message="企业名称不能为空")
	@Length(min=0, max=50, message="企业名称长度不能超过 50 个字符")
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Length(min=0, max=20, message="营业执照号长度不能超过 20 个字符")
	public String getBusinessNum() {
		return businessNum;
	}

	public void setBusinessNum(String businessNum) {
		this.businessNum = businessNum;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getBusinessIndate() {
		return businessIndate;
	}

	public void setBusinessIndate(Date businessIndate) {
		this.businessIndate = businessIndate;
	}

	@Length(min=0, max=255, message="营业执照图片地址长度不能超过 255 个字符")
	public String getBusinessPicture() {
		return businessPicture;
	}

	public void setBusinessPicture(String businessPicture) {
		this.businessPicture = businessPicture;
	}

	@Length(min=0, max=20, message="经营许可证号长度不能超过 20 个字符")
	public String getLicenseNum() {
		return licenseNum;
	}

	public void setLicenseNum(String licenseNum) {
		this.licenseNum = licenseNum;
	}

	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getLicenseIndate() {
		return licenseIndate;
	}

	public void setLicenseIndate(Date licenseIndate) {
		this.licenseIndate = licenseIndate;
	}

	@Length(min=0, max=255, message="许可证图片长度不能超过 255 个字符")
	public String getLicensePicture() {
		return licensePicture;
	}

	public void setLicensePicture(String licensePicture) {
		this.licensePicture = licensePicture;
	}

	@Length(min=0, max=18, message="法人身份证号长度不能超过 18 个字符")
	public String getIdNum() {
		return idNum;
	}

	public void setIdNum(String idNum) {
		this.idNum = idNum;
	}

	@Length(min=0, max=255, message="id_picture长度不能超过 255 个字符")
	public String getIdPicture() {
		return idPicture;
	}

	public void setIdPicture(String idPicture) {
		this.idPicture = idPicture;
	}

	public Employee getEmployee() {
		Employee employee = (Employee)getRefObj();
		if(employee == null) {
			employee = new Employee();
			setRefObj(employee);
		}

		return employee;
	}
	public void setEmployee(Employee employee) {
		setRefObj(employee);
	}

}